package org.osoftware.mumi.dao.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * The Class PaymentPlan.
 */
@Entity
@Table(name="payment_plan")
public class PaymentPlan extends BaseObject{

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 6171989307104858123L;
	
	/** The description. */
	private String description;
	
	/** The payment type. */
	@ManyToOne
	private PaymentType paymentType;
	
	/** The payment details. */
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name = "payment_plan_id", updatable = false, insertable = false, nullable=false)
	private List<PaymentDetail> payments;

	

	/**
	 * Gets the payments.
	 *
	 * @return the payments
	 */
	public List<PaymentDetail> getPayments() {
		return payments;
	}

	/**
	 * Sets the payments.
	 *
	 * @param payments the new payments
	 */
	public void setPayments(List<PaymentDetail> payments) {
		this.payments = payments;
	}

	/**
	 * Gets the description.
	 *
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	
	/**
	 * Sets the description.
	 *
	 * @param description the new description
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * Gets the payment type.
	 *
	 * @return the payment type
	 */
	public PaymentType getPaymentType() {
		return paymentType;
	}
	
	/**
	 * Sets the payment type.
	 *
	 * @param paymentType the new payment type
	 */
	public void setPaymentType(PaymentType paymentType) {
		this.paymentType = paymentType;
	}

	/* (non-Javadoc)
	 * @see org.osoftware.mumi.dao.model.BaseObject#toString()
	 */
	@Override
	public String toString() {
		return "PaymentPlan [description=" + description + ", paymentType="
				+ paymentType + ", toString()=" + super.toString() + "]";
	}
	
	
}
